{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "5a0740c0",
   "metadata": {},
   "outputs": [],
   "source": [
    "(<= (row ?m ?x) (true (cell ?m 1 ?x)) (true (cell ?m 2 ?x)) (true (cell ?m 3 ?x)) (true (cell ?m 4 ?x)))\n",
    "(<= (row ?m ?x) (true (cell ?m 2 ?x)) (true (cell ?m 3 ?x)) (true (cell ?m 4 ?x)) (true (cell ?m 5 ?x)))\n",
    "(<= (row ?m ?x) (true (cell ?m 3 ?x)) (true (cell ?m 4 ?x)) (true (cell ?m 5 ?x)) (true (cell ?m 6 ?x)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "4aa66d17",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(<= (row ?m ?x) (true (cell ?m 1 ?x)) (true (cell ?m 2 ?x)) (true (cell ?m 3 ?x)) (true (cell ?m 4 ?x)))\n",
      "(<= (row ?m ?x) (true (cell ?m 2 ?x)) (true (cell ?m 3 ?x)) (true (cell ?m 4 ?x)) (true (cell ?m 5 ?x)))\n",
      "(<= (row ?m ?x) (true (cell ?m 3 ?x)) (true (cell ?m 4 ?x)) (true (cell ?m 5 ?x)) (true (cell ?m 6 ?x)))\n",
      "\n"
     ]
    }
   ],
   "source": [
    "\n",
    "for i in range(1,4):\n",
    "    print(f\"(<= (row ?m ?x) (true (cell ?m {i} ?x)) (true (cell ?m {i+1} ?x)) (true (cell ?m {i+2} ?x)) (true (cell ?m {i+3} ?x)))\")\n",
    "print()\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "e666bc01",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(<= (column ?n ?x) (true (cell 1 ?n ?x)) (true (cell 2 ?n ?x)) (true (cell 3 ?n ?x)) (true (cell 4 ?n ?x)))\n",
      "(<= (column ?n ?x) (true (cell 2 ?n ?x)) (true (cell 3 ?n ?x)) (true (cell 4 ?n ?x)) (true (cell 5 ?n ?x)))\n",
      "(<= (column ?n ?x) (true (cell 3 ?n ?x)) (true (cell 4 ?n ?x)) (true (cell 5 ?n ?x)) (true (cell 6 ?n ?x)))\n",
      "(<= (column ?n ?x) (true (cell 4 ?n ?x)) (true (cell 5 ?n ?x)) (true (cell 6 ?n ?x)) (true (cell 7 ?n ?x)))\n",
      "\n"
     ]
    }
   ],
   "source": [
    "\n",
    "for i in range(1,5):\n",
    "    print(f\"(<= (column ?n ?x) (true (cell {i} ?n ?x)) (true (cell {i+1} ?n ?x)) (true (cell {i+2} ?n ?x)) (true (cell {i+3} ?n ?x)))\")\n",
    "print()\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "862bd1b5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(<= (diagonal ?x) (true (cell 1 4 ?x)) (true (cell 2 3 ?x)) (true (cell 3 2 ?x)) (true (cell 4 1 ?x)))\n",
      "(<= (diagonal ?x) (true (cell 1 5 ?x)) (true (cell 2 4 ?x)) (true (cell 3 3 ?x)) (true (cell 4 2 ?x)))\n",
      "(<= (diagonal ?x) (true (cell 1 6 ?x)) (true (cell 2 5 ?x)) (true (cell 3 4 ?x)) (true (cell 4 3 ?x)))\n",
      "\n",
      "(<= (diagonal ?x) (true (cell 2 4 ?x)) (true (cell 3 3 ?x)) (true (cell 4 2 ?x)) (true (cell 5 1 ?x)))\n",
      "(<= (diagonal ?x) (true (cell 2 5 ?x)) (true (cell 3 4 ?x)) (true (cell 4 3 ?x)) (true (cell 5 2 ?x)))\n",
      "(<= (diagonal ?x) (true (cell 2 6 ?x)) (true (cell 3 5 ?x)) (true (cell 4 4 ?x)) (true (cell 5 3 ?x)))\n",
      "\n",
      "(<= (diagonal ?x) (true (cell 3 4 ?x)) (true (cell 4 3 ?x)) (true (cell 5 2 ?x)) (true (cell 6 1 ?x)))\n",
      "(<= (diagonal ?x) (true (cell 3 5 ?x)) (true (cell 4 4 ?x)) (true (cell 5 3 ?x)) (true (cell 6 2 ?x)))\n",
      "(<= (diagonal ?x) (true (cell 3 6 ?x)) (true (cell 4 5 ?x)) (true (cell 5 4 ?x)) (true (cell 6 3 ?x)))\n",
      "\n",
      "(<= (diagonal ?x) (true (cell 4 4 ?x)) (true (cell 5 3 ?x)) (true (cell 6 2 ?x)) (true (cell 7 1 ?x)))\n",
      "(<= (diagonal ?x) (true (cell 4 5 ?x)) (true (cell 5 4 ?x)) (true (cell 6 3 ?x)) (true (cell 7 2 ?x)))\n",
      "(<= (diagonal ?x) (true (cell 4 6 ?x)) (true (cell 5 5 ?x)) (true (cell 6 4 ?x)) (true (cell 7 3 ?x)))\n",
      "\n"
     ]
    }
   ],
   "source": [
    "for j in range(1, 5):\n",
    "    for i in range(1,4):\n",
    "        print(f\"(<= (diagonal ?x) (true (cell {j} {i+3} ?x)) (true (cell {j+1} {i+2} ?x)) (true (cell {j+2} {i+1} ?x)) (true (cell {j+3} {i} ?x)))\")\n",
    "    print()\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "38282813",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(<= (diagonal ?x) (true (cell 1 1 ?x)) (true (cell 2 2 ?x)) (true (cell 3 3 ?x)) (true (cell 4 4 ?x)))\n",
      "(<= (diagonal ?x) (true (cell 1 2 ?x)) (true (cell 2 3 ?x)) (true (cell 3 4 ?x)) (true (cell 4 5 ?x)))\n",
      "(<= (diagonal ?x) (true (cell 1 3 ?x)) (true (cell 2 4 ?x)) (true (cell 3 5 ?x)) (true (cell 4 6 ?x)))\n",
      "\n",
      "(<= (diagonal ?x) (true (cell 2 1 ?x)) (true (cell 3 2 ?x)) (true (cell 4 3 ?x)) (true (cell 5 4 ?x)))\n",
      "(<= (diagonal ?x) (true (cell 2 2 ?x)) (true (cell 3 3 ?x)) (true (cell 4 4 ?x)) (true (cell 5 5 ?x)))\n",
      "(<= (diagonal ?x) (true (cell 2 3 ?x)) (true (cell 3 4 ?x)) (true (cell 4 5 ?x)) (true (cell 5 6 ?x)))\n",
      "\n",
      "(<= (diagonal ?x) (true (cell 3 1 ?x)) (true (cell 4 2 ?x)) (true (cell 5 3 ?x)) (true (cell 6 4 ?x)))\n",
      "(<= (diagonal ?x) (true (cell 3 2 ?x)) (true (cell 4 3 ?x)) (true (cell 5 4 ?x)) (true (cell 6 5 ?x)))\n",
      "(<= (diagonal ?x) (true (cell 3 3 ?x)) (true (cell 4 4 ?x)) (true (cell 5 5 ?x)) (true (cell 6 6 ?x)))\n",
      "\n",
      "(<= (diagonal ?x) (true (cell 4 1 ?x)) (true (cell 5 2 ?x)) (true (cell 6 3 ?x)) (true (cell 7 4 ?x)))\n",
      "(<= (diagonal ?x) (true (cell 4 2 ?x)) (true (cell 5 3 ?x)) (true (cell 6 4 ?x)) (true (cell 7 5 ?x)))\n",
      "(<= (diagonal ?x) (true (cell 4 3 ?x)) (true (cell 5 4 ?x)) (true (cell 6 5 ?x)) (true (cell 7 6 ?x)))\n",
      "\n"
     ]
    }
   ],
   "source": [
    "for j in range(1, 5):\n",
    "    for i in range(1,4):\n",
    "        print(f\"(<= (diagonal ?x) (true (cell {j} {i} ?x)) (true (cell {j+1} {i+1} ?x)) (true (cell {j+2} {i+2} ?x)) (true (cell {j+3} {i+3} ?x)))\")\n",
    "    print()\n",
    "    "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
